#include "Overseer.h"
#include "InputManager.h"
#include "TitleScreenState.h"

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32a
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>

INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT)
#else
int main(int argc, char **argv)
#endif
{
	Overseer *overseer;
	
	try
	{
		overseer = new Overseer();
		if (!overseer->initialise()) return 1;
		overseer->changeState(new TitleScreenState(overseer));
		while (overseer->isRunning()) overseer->update();
		overseer->cleanup();
	}
	catch(Ogre::Exception &e)
	{
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32a
		MessageBox(NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
#else
		std::cerr << "An exception has occurred: " << e.getFullDescription().c_str() << std::endl;
#endif
	}

	return 0;
}